-
Notifications
You must be signed in to change notification settings - Fork 819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prevent stuck scrollbar #2003
prevent stuck scrollbar #2003
Conversation
and not event.button | ||
and self._last_move_event is not None | ||
): | ||
buttons = list(dict.fromkeys(self._down_buttons).keys()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this the same as list(self._down_buttons)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, it will additionally unique-ify them. Wether that is strictly necessary, I'm not certain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right. In that case, why not just buttons = set(self._down_buttons)
and then iterate over the set
?
Or do we need to preserve order?
It makes a bit more sense, it is probably faster, and doesn't require a comment explaining the hoops you are going over.
Otherwise, I think this warrants a comment.
Depending on what you reply to this comment, I don't mind PR'ing the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is intended to preserve order. So that any button ups, arrive in the same order as they went down. Feel free to add a comment.
Related comment: https://github.com/Textualize/textual/pull/2003\#discussion_r1131081129 Related PR: #2003.
Related comment: https://github.com/Textualize/textual/pull/2003\#discussion_r1131081129 Related PR: #2003.
Fixes the issue when you grab a scrollbar, move outside the terminal, and release the mouse button. The scrollbar would get attached to the mouse until you clicked the button again.
There was a previous attempt at this in #1968 but it didn't quite do the job.